package com.ruoyi.system.convert;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import com.ruoyi.system.domain.Test;
import com.ruoyi.system.domain.dto.TestDto;
import com.ruoyi.system.domain.vo.TestVo;
import org.mapstruct.factory.Mappers;

import java.util.List;


/**
 * 测试对象 test转换器
 *
 * @author ruoyi
 * @date 2024-09-04
 */
@Mapper(componentModel = "spring")
public interface TestConvert {
    /**
    * 获取该类自动生成的实现类的实例
    *
    */
    TestConvert INSTANCE =Mappers.getMapper(TestConvert.class);

    /**
    * 这个方法就是用于实现对象属性复制的方法
    *
    * @Mapping 注解 用于定义属性复制规则
    * source 指定源对象属性
    * target指定目标对象属性
    *
    * @param test 这个参数就是源对象，也就是需要被复制的对象
    * @return 返回的是目标对象，就是最终的结果对象
    */
    @Mappings({
            @Mapping(source = "id", target =  "id"),
            @Mapping(source = "name", target =  "name"),
            @Mapping(source = "sex", target =  "sex"),
            @Mapping(source = "createBy", target =  "createBy"),
            @Mapping(source = "createTime", target =  "createTime"),
            @Mapping(source = "updateBy", target =  "updateBy"),
            @Mapping(source = "updateTime", target =  "updateTime"),
            @Mapping(source = "remark", target =  "remark"),
            @Mapping(source = "isDelete", target =  "isDelete"),
    })
        TestVo TestToTestVo(Test test);

    @Mappings({
                @Mapping(source = "id", target =  "id"),
                @Mapping(source = "name", target =  "name"),
                @Mapping(source = "sex", target =  "sex"),
                @Mapping(source = "createBy", target =  "createBy"),
                @Mapping(source = "createTime", target =  "createTime"),
                @Mapping(source = "updateBy", target =  "updateBy"),
                @Mapping(source = "updateTime", target =  "updateTime"),
                @Mapping(source = "remark", target =  "remark"),
                @Mapping(source = "isDelete", target =  "isDelete"),
    })
        TestDto TestToTestDto(Test test);

    @Mappings({
                @Mapping(source = "id", target =  "id"),
                @Mapping(source = "name", target =  "name"),
                @Mapping(source = "sex", target =  "sex"),
                @Mapping(source = "createBy", target =  "createBy"),
                @Mapping(source = "createTime", target =  "createTime"),
                @Mapping(source = "updateBy", target =  "updateBy"),
                @Mapping(source = "updateTime", target =  "updateTime"),
                @Mapping(source = "remark", target =  "remark"),
                @Mapping(source = "isDelete", target =  "isDelete"),
    })
        Test TestDtoToTest(TestDto testDto);

    @Mappings({
                @Mapping(source = "id", target =  "id"),
                @Mapping(source = "name", target =  "name"),
                @Mapping(source = "sex", target =  "sex"),
                @Mapping(source = "createBy", target =  "createBy"),
                @Mapping(source = "createTime", target =  "createTime"),
                @Mapping(source = "updateBy", target =  "updateBy"),
                @Mapping(source = "updateTime", target =  "updateTime"),
                @Mapping(source = "remark", target =  "remark"),
                @Mapping(source = "isDelete", target =  "isDelete"),
    })
        Test TestVoToTest(TestVo testVo);

    @Mappings({
                @Mapping(source = "id", target =  "id"),
                @Mapping(source = "name", target =  "name"),
                @Mapping(source = "sex", target =  "sex"),
                @Mapping(source = "createBy", target =  "createBy"),
                @Mapping(source = "createTime", target =  "createTime"),
                @Mapping(source = "updateBy", target =  "updateBy"),
                @Mapping(source = "updateTime", target =  "updateTime"),
                @Mapping(source = "remark", target =  "remark"),
                @Mapping(source = "isDelete", target =  "isDelete"),
    })
      List<Test> TestVoListToTestList(List<TestVo> testVoList);

    @Mappings({
                @Mapping(source = "id", target =  "id"),
                @Mapping(source = "name", target =  "name"),
                @Mapping(source = "sex", target =  "sex"),
                @Mapping(source = "createBy", target =  "createBy"),
                @Mapping(source = "createTime", target =  "createTime"),
                @Mapping(source = "updateBy", target =  "updateBy"),
                @Mapping(source = "updateTime", target =  "updateTime"),
                @Mapping(source = "remark", target =  "remark"),
                @Mapping(source = "isDelete", target =  "isDelete"),
    })
    List<Test> TestDtoListToTestList(List<TestDto> testDtoList);

    @Mappings({
                @Mapping(source = "id", target =  "id"),
                @Mapping(source = "name", target =  "name"),
                @Mapping(source = "sex", target =  "sex"),
                @Mapping(source = "createBy", target =  "createBy"),
                @Mapping(source = "createTime", target =  "createTime"),
                @Mapping(source = "updateBy", target =  "updateBy"),
                @Mapping(source = "updateTime", target =  "updateTime"),
                @Mapping(source = "remark", target =  "remark"),
                @Mapping(source = "isDelete", target =  "isDelete"),
    })
    List<TestDto> TestListToTestDtoList(List<Test> testList);

    @Mappings({
                @Mapping(source = "id", target =  "id"),
                @Mapping(source = "name", target =  "name"),
                @Mapping(source = "sex", target =  "sex"),
                @Mapping(source = "createBy", target =  "createBy"),
                @Mapping(source = "createTime", target =  "createTime"),
                @Mapping(source = "updateBy", target =  "updateBy"),
                @Mapping(source = "updateTime", target =  "updateTime"),
                @Mapping(source = "remark", target =  "remark"),
                @Mapping(source = "isDelete", target =  "isDelete"),
    })
    List<TestVo> TestListToTestVoList(List<Test> testList);

}
